<?php

namespace app\admin\controller;


use think\Db;

class Index extends Common{

	public function index(){
		return $this->fetch();
	}

	public function newMessage(){
		$a1 = Db::table('tp_out_record')->where('status',0)->count()?:0;
		$a2 = Db::table('tp_out_record')->where('status',0)->where('amount','>=',100)->count()?:0;
		$b3 = Db::table('tp_out_record')->where('status','in','0,1')->whereTime('date','>',strtotime('-7 days'))->field('uid')->group('uid')->having('count(*)>=3')->select();
		if ($b3) {
			$b3 = array_column($b3, 'uid');
			$a3 = implode($b3, ',');
		} else {
			$a3 = 0;
		}
		
		$b4 = Db::table('tp_out_record')->where('status',0)->where('is_wu',1)->field('uid')->group('uid')->select();
		if ($b4) {
			$b4 = array_column($b4, 'uid');
			$a4 = implode($b4, ',');
		} else {
			$a4 = 0;
		}

		$a5 = Db::table('tp_balance_record')->where('type',12)->whereTime('date','>',date('Y-m-d H:i:s',time()-30))->count()?:0;
			
		if ($a1 || $a2 || $b3 ||$b4 || $a5) {
			return ['code'=>0,'msg'=>'success','data'=>['a1'=>$a1,'a2'=>$a2,'a3'=>$a3,'a4'=>$a4,'a5'=>$a5]];
		} else {
			return ['code'=>1];
		}	
	}
}